package com.glink.manage.vo.silentresult;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
* @author  qiushaoshan
* @since 2025-01-20
*/
@ApiModel(value="SilentResultAnalysisVO对象", description="静默结果-算法分析")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SilentResultAnalysisSignalVO implements Comparable<SilentResultAnalysisSignalVO>, Serializable  {

    private static final long serialVersionUID = 5352900385881375474L;

    private String action;
    private Integer order;
    private LocalDateTime taskJoinTime;
    
    @ApiModelProperty(value = "主键")
    private String objId;

    @ApiModelProperty(value = "文件路径")
    private String filePath;
    
    @Override
    public int compareTo(SilentResultAnalysisSignalVO taskSignal) {
        if (Objects.equals(this.order, taskSignal.getOrder())) {
            if (getTaskJoinTime().isAfter(taskSignal.getTaskJoinTime())) {
                return 1;
            }
            return 0;
        }
        return taskSignal.getOrder() - this.order;
    }
}
